<extend name="Public/Common/base.html" />
<block name="main">

<style>
.am-table{
	font-size:13px;
}
</style>
<table class="am-table am-table-compact am-table-centered am-scrollable-horizontal   am-table-bordered">
    <thead>
        <tr>
            <th>id</th>
            <th>角色名称</th>
            <th>角色描述</th>
             <th>状态</th>
             <th>操作</th>
        </tr>
    </thead>
    <tbody>
    <volist name="grouplist" id="vo">
        <tr>
            <td>{$i}</td>
            <td>{$vo.title}</td>
            <td>{$vo.describe}</td>
            <td><if condition="$vo.status eq 1">开启<else/>关闭</if></td>         
            <td>
            <a href="{:U('Group/edit?id='.$vo['id'])}">
            <button class="am-btn am-btn-primary am-btn-xs {$status}">编辑</button>
            </a>
            <a onclick='return del("{$vo.id}")'>
            <button  class="am-btn am-btn-warning am-btn-xs {$status}">删除</button>
            </a>
             <a href="{:U('Group/authority',array('id'=>$vo['id'],'name'=>$vo['title']))}">
            <button  class="am-btn am-btn-success am-btn-xs {$status}">分配权限</button>
            </a>
            </td>
        </tr>
       </volist>
    </tbody>
</table>
	<div class="am-g">
       <a href="{:U('Group/add')}">
           <button class="am-btn am-btn-primary am-btn-sm {$status}">{$info}</button>
        </a>
	</div>
 
<js href="__PUBLIC__/layer/layer.js" />
<script type="text/javascript">
function del(id){
	layer.confirm('您确定要删除这条数据吗？', {
	btn: ['确定','取消']
	}, function()
	{
	$.ajax({
	url: "__MODULE__/Group/delete",
	type: "get",
	data:{"id":id},
	dataType: "json",
	beforeSend:function(){
		layer.msg('正在删除', {
			  icon: 16
			  ,shade: 0.01
			});
	},
	success: function(data){
	if(data.state==1){
	location.href = location.href;
	layer.msg(data.msg, {icon: 6});
	}else{
	layer.msg(data.msg, {icon: 5});
	}
	},
	error:function(){
		layer.msg('服务异常！');
	}
	
	});


	});
	}
	

</script> 	 
        
      
</block>
